#!/usr/bin/env python

import sys
sys.path.append('./mechanize')

import mechanize
import cookielib

br = mechanize.Browser()
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]

br.open('https://software.intel.com/protected-download/267266/144917')
br.select_form(nr=1)
br.find_control(type="checkbox").items[0].selected = True
br.submit()
br.retrieve('https://software.intel.com/system/files/managed/b4/0d/' + sys.argv[1], sys.argv[1])

